import json
import ast


# def excute_checkId(checkid):
#     """
#     处理输入字符串：
#     1. 如果是普通字符串，返回原值
#     2. 如果字符串表示单元素列表（如 '["a"]'），返回列表中的值
#     3. 如果字符串表示双元素列表（如 '["a","b"]'），返回列表本身
#     4. 其他情况返回原始字符串
#     """
#     # 尝试解析为JSON格式
#     try:
#         # 使用ast.literal_eval安全解析
#         checkid = ast.literal_eval(checkid)
#
#         # 检查解析结果是否为列表
#         if isinstance(checkid, list):
#             # 处理单元素列表
#             if len(checkid) == 1:
#                 checkid = checkid[0]
#                 return checkid
#             # 处理双元素列表
#             elif len(checkid) == 2:
#                 checkid_0 = checkid[0]
#                 checkid_1 = checkid[1]
#                 res_json_value = self.all_res_json[checkid_0]
#                 checkid = self.ak.json_path(res_json_value, checkid_1)[0]
#                 return checkid
#             # 其他长度的列表返回原始字符串
#             else:
#                 value = "构造值checkId格式错误"
#                 print(value)
#
#         # 非列表类型返回原始字符串
#         return checkid
#
#     # 解析失败说明是普通字符串
#     except (ValueError, SyntaxError):
#         return checkid

        # 处理excel传入的构造值
    # def excute_checkId1(checkid):
    #     """
    #     :param checkid: 传入的值必须是一个列表，列表中有一个值时返回列表中的值，列表为两个值时，值1为excel表的id,值2为jsonpath表达式
    #     :return:列表只有一个值时返回列表中的那一个值，传入列表中传入两个值时通过id取出全局变量all_json_value对应的值，在用值2jsonpath表达式提取出所需要的checkid
    #     """
    #     try:
    #         if isinstance(checkid, list) and len(checkid) == 1:
    #             checkid = checkid[0]
    #         elif isinstance(checkid, list) and len(checkid) == 2:
    #             checkid_0 = checkid[0]
    #             checkid_1 = checkid[1]
    #             res_json_value = self.all_res_json[checkid_0]
    #             checkid = self.ak.json_path(res_json_value, checkid_1)[0]
    #         else:
    #             value = "checkid格式错误"
    #             print(value)
    #             logging.info(value)
    #     except Exception as e:
    #         value = "checkid获取错误"
    #         print(value)
    #         logging.info(value)
    #     finally:
    #         return checkid

if __name__ == '__main__':
    # a = 1
    # b = "2"
    # c = "[3]"
    # d = "[3, 4]"
    # e = "哈哈哈"
    # f = "[5, 6, 7]"
    # print(process_string(a))
    # print(process_string(b))
    # print(process_string(c))
    # print(process_string(d))
    # print(process_string(e))
    # print(process_string(f))
    y = ()
    s = 11111111111111111111111
    s = (str(s),)
    s_dict = {"a":1}
    s_dict = (str(s_dict),)
    print(s)
    print(s_dict)
